<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<div class="portlet box green">
	<div class="portlet-title">
		<div class="caption">
			<i class="fa fa-gift"></i>编辑
		</div>
	</div>
	<div class="portlet-body form">
		<form id="ordertForm" class="form-horizontal form-bordered"
			action="/ordert/ListFormsaves" method="post">
			<div class="form-group">
				<label class="col-md-3 control-label">订单日期:</label>
				<div class="col-md-4">
					<input type="text" name="createtime" class="form-control"
						value="${ordert.createtime}" maxlength="45" readonly />
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">订单编号:</label>
				<div class="col-md-4">
					<input type="text" name="code" class="form-control"
						value="${ordert.code}" maxlength="10" readonly />
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">买家ID:</label>
				<div class="col-md-4">
					<input type="text" name="uid" class="form-control"
						value="${ordert.person.uid}" maxlength="22" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">购买数量:</label>
				<div class="col-md-4">
					<input type="text" name="count" class="form-control"
						value="${ordert.count}" maxlength="45" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">金额:</label>
				<div class="col-md-4">
					<input type="text" name="price" class="form-control"
						value="${ordert.price}" maxlength="10" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">备注:</label>
				<div class="col-md-4">
					<textarea class="form-control" rows="3" name="description">${ordert.description}</textarea>

				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">订单平台:</label>
				<div class="col-md-4">
					<select class="form-control" id="platformId">
						<option value="${ordert.platformId}" selected>${ordert.platform.name}</option>
						<c:forEach items="${pflist}" var="p" varStatus="vs">
							<option value="${p.code}">${p.name}</option>
						</c:forEach>

					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">订单状态:</label>
				<div class="col-md-4">

					<select class="form-control" id="orderStatusId">

						<option value="${ordert.orderStatusId}" selected>${ordert.orderStatus.name}</option>
						<c:forEach items="${stlist}" var="s" varStatus="vs">
							<option value="${s.code}">${s.name}</option>
						</c:forEach>

					</select>
				</div>
			</div>


			<div class="form-actions">
				<div class="col-md-9 col-md-offset-3">
					<button type="button" class="btn btn-primary" onclick="saveOrder()">
						<spring:message code="btn.save"></spring:message>
					</button>
					<button type="reset" class="btn btn-default" onclick="cancel()">
						<spring:message code="btn.return"></spring:message>
					</button>
				</div>
			</div>
			<input type="hidden" name="id" value="${ordert.id}">
		</form>
	</div>
</div>
<script type="text/javascript"
	src="<c:url value="/static/custom/datepicker-util.js"></c:url>"></script>
<script type="text/javascript">
	$(function() {

	});

	function saveOrder() {

		var platformId = $('#platformId option:selected').val();
		var orderStatusId = $('#orderStatusId option:selected').val();

		$.ajax({
			type : 'post',
			url : webRoot + '/ordert/ListFormsaves?platformId=' + platformId
					+ '&orderStatusId=' + orderStatusId,
			data : $('#ordertForm').serialize(),
			dataType : 'json',
			success : function(data) {
				alert(data.result)
				search();
				$(".panel-search").show();
			}
		});

	}
</script>